#include<iostream>
#include<vector>
#include<unordered_map>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_set>
#include<bits/stdc++.h>
#define fi first
#define se second
#define SIZE(x) ((int)x.size())
#define out(x) cerr<<#x<<" = "<<(x)<<endl;
#define MP(a,b) make_pair(a,b)
using namespace std;
typedef long long ll;
#define VI vector<int>
#define VVI vector< vector<int> >
#define VC vector<char>
#define PI pair<int,int>
#define PL pair<ll,ll>
#define EPS 0.000001


inline int lson(int x){return x<<1;}
inline int rson(int x){return (x<<1)|1;}

inline int read()
{
	int x=0,f=1;char ch=getchar();
	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}
	while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
	return x*f;
}

template<typename T> 
inline void read(T &x){
	x=0;T f=1;char ch;
	do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
	do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}


//#define INF 5340172838076674L
#define INF 1000000000
#define MOD 1000000009
inline ll mod(ll x){
	return ((x%10)+10)%10;
}

struct node{
	int a,b;
	bool operator<(const node& x)const{
		if(a!=x.a)return a<x.a;
		return b>x.b;
	};
};

struct no{
	ll a,b,c;
	bool operator<(const no& x)const{
		return c<x.c;
	}
};

string s_sub(const string &a,const string &b){
	//a>b
	string res=a;
	int c=0,i,tmp;
	for(i=1;i<=b.size();i++){
		tmp=a[a.size()-i]-b[b.size()-i]-c;
		if(tmp<0){
			c=1;
			res[a.size()-i]='0'+10+tmp;
		}else {res[a.size()-i]='0'+tmp;c=0;}
	}
	while(c&&i<=a.size()){
		res[a.size()-i]-=c;
		if(res[a.size()-i]<'0')res[a.size()-i]+=10;
		else c=0;
		i++;
	}
	for(i=0;i<res.size();i++)if(res[i]!='0')break;
	if(i==res.size())return "0";
	return res.substr(i);
}
string s_add(const string &a,const string &b){
	string ans,oth;
	if(a.size()>b.size()){
		ans=a;
		oth=b;
	}else ans=b,oth=a;
	int c=0,pos,tmp;
	int i;
	for(i=1;i<=oth.size();i++){
		pos=ans.size()-i;
		tmp=c+ans[pos]-'0'+oth[oth.size()-i]-'0';
		ans[pos]='0'+(tmp%10);
		c=tmp/10;
	}
	while(c&&i<=ans.size()){
		pos=ans.size()-i;
		tmp=c+ans[pos]-'0';
		ans[pos]='0'+(tmp%10);
		c=tmp/10;
		i++;
	}
	if(c){
		ans=((char)(c+'0'))+ans;
	}
	return ans;
}

string s_mul(const string &a,const string &b){
	int n=a.size(),m=b.size();
	string ans(n+m,'0');
	int c=0,tmp,pos;
	int i,j;
	for(i=1;i<=n;i++){
		for(j=1;j<=m;j++){
			pos=(int)ans.size()+1-i-j;
			tmp=(ans[pos]-'0')+c+(int)(a[n-i]-'0')*(b[m-j]-'0');
			ans[pos]='0'+(tmp%10);
			c=tmp/10;
		}
		while(c){
			pos=(int)ans.size()+1-i-j;
			tmp=(ans[pos]-'0')+c;
			ans[pos]='0'+(tmp%10);
			c=tmp/10;
		}
	}
	for(i=0;i<ans.size();i++)if(ans[i]!='0')break;
	if(i==ans.size())return "0";
	return ans.substr(i);
}

string s_max(const string &a,const string &b){
	if(a.size()==b.size())return a<b?b:a;
	return a.size()<b.size()?b:a;
}

//ax+by=1
void exgcd(ll a,ll b,ll &x,ll &y){
	if(b==0){x=1;y=0;return;}
	exgcd(b,a%b,y,x);y-=(a/b)*x;
}
ll qm(ll x,ll a){
	ll res=1;
	while(a){
		res=(res*x)%MOD;
		a>>=1;
		x=(x*x)%MOD;
	}
	return res;
}

ll dat[100005];
ll st[20][100005];
ll gg(int a,int b){
	int x=(b-a+1);
	int w=20;
	while(w&&(1<<w)>x)w--;
	return min(st[w][a],st[w][1+b-(1<<w)]);
}
int main(){
    #ifdef BUG
    freopen("a.in","r",stdin);
    #endif
	ll n=read(),m=read(),t=read();
	ll res=INT_MAX;
	if(t==0){
		cout<<0<<endl;
		return 0;
	}
	ll a,b;
	ll maxb=0;
	memset(dat,0x1f,sizeof dat);
	for(int i=0;i<n;i++){
		a=read();b=read();
		if(b>=t)res=min(res,a);
		else {
			dat[b]=min(dat[b],a);
			maxb=max(b,maxb);
		}
	}
	memset(st,0x1f,sizeof st);
	for(int i=0;i<=maxb;i++)st[0][i]=dat[i];
	for(int i=1;i<20;i++){
		for(int j=0;j<=maxb;j++){
			if(j+(1<<i)<=maxb+1)st[i][j]=
				min(st[i-1][j],st[i-1][j+(1<<(i-1))]);
		}
	}
	for(int i=0;i<m;i++){
		a=read();b=read();
		if(b>=t)res=min(res,a);
		else{
			//cout<<a<<' '<<(t-b)<<gg(t-b,maxb)<<endl;
			if(t-b<=maxb)res=min(res,a+gg(t-b,maxb));
		}
	}
	if(res==INT_MAX)cout<<-1<<endl;
	else cout<<res<<endl;
}